package com.xlu.Controller;

import com.xlu.dto.SearchClass;
import com.xlu.result.Result;
import com.xlu.serve.ClassServe;
import com.xlu.serve.MajorServe;
import com.xlu.vo.ClassesVO;
import com.xlu.vo.MajorVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/admin/class")
@RestController
@Slf4j
@Api("班级相关")
public class ClassController {
    @Autowired
    private ClassServe classServe;
    @GetMapping("/ListByCollege")
    public Result getClassByMajor(SearchClass searchClass){

        log.info("根据专业ID 学院查询班级{}", searchClass);
        Integer MajorId = searchClass.getMajorId();
        Integer CollegeId = searchClass.getCollegeId();
        List<ClassesVO> classesVOS = classServe.getClassByMajor(MajorId,CollegeId);
        log.info("根据专业ID查询班级{} 数据{}",searchClass,classesVOS);
        return Result.success(classesVOS);
    }
}
